//
//  HomelForwardTableViewCell.swift
//  JKWeiBo
//
//  Created by 王冲 on 2017/12/20.
//  Copyright © 2017年 希爱欧科技有限公司. All rights reserved.
//

import UIKit

class HomelForwardTableViewCell: HomelTableViewCell {
    
    // 重写父类属性的didSet并不会覆盖父类的操作
    // 只需要在重写方法中, 做自己想做的事即可
    // 注意点: 如果父类是didSet, 那么子类重写也只能重写didSet
    override var homeViewModel: HomeViewModel?
        {
        didSet{
//            let name = homeViewModel?.retweeted_status?.user?.name ?? ""
//            let text = homeViewModel?.retweeted_status?.text ?? ""
//            forwardLabel.text = name + ": " + text
            
            
//            forwardGrayButton.y = label.frame.maxY + 10
//            forwardGrayButton.height = homePictureView.height+20
//            
            homePictureView.y = label.frame.maxY+20
            
            // 设置工具条的位置
            footview.y = homePictureView.frame.maxY+10
        }
    }
    
    override func setUpUI() {
        // 1.先调用一下父类的布局
        super.setUpUI()
        
        // 2.布局子控件
        //contentView.insertSubview(forwardGrayButton, aboveSubview: footview)
        //contentView.insertSubview(forwardLabel, aboveSubview: forwardGrayButton)
        
    }
    
    // 1.正文
    lazy var forwardLabel: UILabel = {
        let label = UILabel.createlabel(color: UIColor.black, fontSize: 14)
        label.x = 12
        label.width = JKscreenW-24
        label.y = 74
        label.numberOfLines = 0
        label.textAlignment = NSTextAlignment.left
        //self.label?.backgroundColor = UIColor.JKRandomColor()
        return label
    }()
    
    // 2.添加转发的灰色背景视图
    lazy var forwardGrayButton: UIButton = {
        
        let button = UIButton()
        button.x = 0;
        button.width = JKscreenW
        button.backgroundColor = UIColor.red
        return button
        
    }()

}
